<template>
  <mt-header :title="title" :class="{transparent:transparent}" fixed>
    <mt-button icon="back" @click="backHandle" slot="left" v-if="!noBack">返回</mt-button>
    <span slot="right">
      <slot name="right"></slot>
    </span>
  </mt-header>
</template>
<script>
  export default {
    props: {
      title: String,
      backTo: {
        type: String,
        default: ''
      },
      transparent: {
        type: Boolean,
        default: false
      },
      noBack: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {}
    },
    methods: {
      backHandle() {
        if (this.backTo !== '') {
          this.$router.push({
            name: this.backTo
          })
        } else {
          this.$router.go(-1)
        }
      }
    }
  }
</script>